Plan of analysis to be carried out

for simple diagrams,

for complex connections - sankey diagram - for the link between printing methods + printing model with a link to the bioink type (+ origin)?

first things first, to give numbers of studies that report e.g. A or B

Printing Techniques

Give an overview of the different printing techniques, - method - printer model - printer source - forms - software

Kind of Printer Method

t1 <- table(reconciled$`4.1 What kind of printing method is used?_ae684e28-4f90-44ad-9de2-731d076de0b0_Answer`)
##
        # Extrusion based Extrusion based|Unclear            Inject based 
        #              37                       1                       4 
        #           Other       Stereolithography                 Unclear 
        #               9                       2                      10

# proportions instead of absolute value of number of studies 
prop.table(table(reconciled$`4.1 What kind of printing method is used?_ae684e28-4f90-44ad-9de2-731d076de0b0_Answer`))
## 
##                   Extrusion based Extrusion based|Stereolithography 
##                        0.60317460                        0.01587302 
##                      Inject based                             Other 
##                        0.06349206                        0.19047619 
##                 Stereolithography                           Unclear 
##                        0.03174603                        0.09523810
 # barplot(t1, ylab = "Number of studies", ylim=c(0, max(t1) + 20),cex.names=.5 , col = "green")

text(x = barplot(t1, ylab = "Number of studies", ylim=c(0, max(t1) + 10), cex.names=.5 , col = "green", main = "Kind of printing method used"), y = t1 + 2, labels = t1, cex = 0.8)

### ABB add table to specfiy other 


# -- link printing method with bioInk type - 

Reporting of Printer Model

#### Reporting of Printer Model

t2 <- table(reconciled$`4.1.1 Do the authors report the printer model name/number?_a3e72486-56d3-4154-a45f-9fb87b8612fc_Answer`)
         # Not reported Not reported|Reported              Reported 
         #           22                     1                    4


# barplot(table(reconciled$`4.1.1 Do the authors report the printer model name/number?_a3e72486-56d3-4154-a45f-9fb87b8612fc_Answer`), ylab = "Number of studies")

text(x = barplot(t2, ylab = "Number of studies", ylim=c(0, max(t2) + 10), cex.names=.5 , col = "green", main = "Is printer model name/number reported"), y = t2 + 2, labels = t2, cex = 0.8)

Printer Source

#### Reporting of Printer Source

t3 <- table(reconciled$`4.1.2 What is the source of the printer?_102ba965-5234-4b3e-8b23-bd70cf4e074d_Answer`)
         # commercial modified commercial        not reported 
         #         36                   4                   4 
         #  self-made             unclear  unclear|commercial 
         #         13                   5                   1

# barplot(table(reconciled$`4.1.2 What is the source of the printer?_102ba965-5234-4b3e-8b23-bd70cf4e074d_Answer`), ylab = "Number of studies", cex.names=.5,  col = "green")

text(x = barplot(t3, ylab = "Number of studies", ylim=c(0, max(t3) + 10), cex.names=.5 , col = "green", main = "Source of the printer"), y = t3 + 2, labels = t3, cex = 0.8)

Printer Forms

#### Reporting of Printer forms
# split is based on the ink

table(reconciled$`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`)
## 
##                        Grid                  Grid;Other 
##                          19                           1 
##                   Grid|Grid               lobular liver 
##                           2                           7 
##         lobular liver;Other lobular liver|lobular liver 
##                           1                           2 
##                       Other                 Other|Other 
##                          25                           5 
##                     Toroids 
##                           1
        #                Grid                  Grid;Other 
        #                  19                           1 
        #           Grid|Grid               lobular liver 
        #                   2                           7 
        # lobular liver;Other lobular liver|lobular liver 
        #                   1                           2 
        #               Other                 Other|Other 
        #                  25                           5 
        #             Toroids 
        #                   1

# ABB to clean these responses
# Those with a semicolon response ; should now be called "combo"
# responses separate with a pipe should be merged when they are saying the same thing. 

printer_forms <- reconciled %>% 
  mutate(`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`= recode(`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`, "Grid|Grid" = "Grid")) %>% 
  mutate(`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`= recode(`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`, "lobular liver|lobular liver" = "lobular liver")) %>% 
  mutate(`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`= recode(`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`, "Other|Other" = "Other")) %>% 
  mutate(`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`= recode(`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`, "Grid;Other" = "Combination")) %>% 
  mutate(`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`= recode(`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`, "lobular liver;Other" = "Combination"))

t4 <-table(printer_forms$`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`)


# barplot(table(printer_forms$`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`), ylab = "Number of studies", cex.names=.5 , col = "green")

text(x = barplot(t4, ylab = "Number of studies", ylim=c(0, max(t4) + 10), cex.names=.5 , col = "green", main = "What kind of forms are printed with this ink"), y = t4 + 2, labels = t4, cex = 0.8)

Printer Forms Overtime

printer_form_year<- table(printer_forms$`4.1.4 What kind of forms are printed with this ink?_01d3ca37-1e2f-4087-8f39-c183f98f0c4e_Answer`, printer_forms$NA_Year)


printer_form_yearDF <- as.data.frame(printer_form_year)
# long to wide 
printer_form_yearDF <- printer_form_yearDF %>% spread(
   key = Var2, 
   value = Freq)


# printer_form_yearDF 
# names(printer_form_yearDF) <- gsub(x = names(printer_form_yearDF), pattern = "X", replacement = "")  


library(formattable)

formattable(printer_form_yearDF,
            #align =c("l", "r"),
            list(
              `Indicator Name` = formatter(
              "span", 
              style = ~ style(color = "grey",font.weight = "bold")), 
             area(row = 1:5) ~ color_tile("white", "green")))
## Warning in gradient(as.numeric(x), ...): NAs introduced by coercion
Var1 2010 2011 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022
Grid 0 0 0 1 0 2 4 4 1 4 5 0
Combination 0 0 0 0 0 0 0 1 0 1 0 0
lobular liver 0 0 0 0 0 1 0 2 1 2 2 1
Other 1 1 1 0 1 5 2 6 3 5 2 3
Toroids 0 0 0 0 1 0 0 0 0 0 0 0

Printer Software

#### Reporting of Printer software

table(reconciled$`4.1.5 Do the authors report the name of the 3D modelling software?_f88d82a9-410c-4118-ad6a-4535d12c4aca_Answer`)
## 
##             No          No|No Not applicable            Yes 
##             39              1              1             22
            # No          No|No Not applicable            Yes 
            # 39              1              1             22

## ABB combine No|No into the "No" group 
printer_soft <- reconciled %>% 
  mutate(`4.1.5 Do the authors report the name of the 3D modelling software?_f88d82a9-410c-4118-ad6a-4535d12c4aca_Answer` = recode(`4.1.5 Do the authors report the name of the 3D modelling software?_f88d82a9-410c-4118-ad6a-4535d12c4aca_Answer`, "No|No" = "No") )

t5 <- table(printer_soft$`4.1.5 Do the authors report the name of the 3D modelling software?_f88d82a9-410c-4118-ad6a-4535d12c4aca_Answer`)

# barplot(table(printer_soft$`4.1.5 Do the authors report the name of the 3D modelling software?_f88d82a9-410c-4118-ad6a-4535d12c4aca_Answer`), ylab = "Number of studies", cex.names=.5, col = "green")

text(x = barplot(t5, ylab = "Number of studies", ylim=c(0, max(t5) + 10), cex.names=.5 , col = "green", main = "Is the 3D modelling software reported"), y = t5 + 2, labels = t5, cex = 0.8)

## Slicing Software

# - since the review started, many cases - not applicable 
# merge NA with No and merge No|No with NO
table(reconciled$`4.1.6 Do the authors report the name of slicing software?_bc07fc45-10aa-441f-9bdf-b32f5037389f_Answer`)
## 
##             No          No|No Not applicable            Yes 
##             53              1              1              8
            # No          No|No Not applicable            Yes 
            # 53              1              1              8 

## ABB to clean No|No and Not applicable into the No option. 

printer_slice <- printer_soft %>% 
  mutate(`4.1.6 Do the authors report the name of slicing software?_bc07fc45-10aa-441f-9bdf-b32f5037389f_Answer` = recode(`4.1.6 Do the authors report the name of slicing software?_bc07fc45-10aa-441f-9bdf-b32f5037389f_Answer`, "No|No" = "No")) %>% 
   mutate(`4.1.6 Do the authors report the name of slicing software?_bc07fc45-10aa-441f-9bdf-b32f5037389f_Answer` = recode(`4.1.6 Do the authors report the name of slicing software?_bc07fc45-10aa-441f-9bdf-b32f5037389f_Answer`, "Not applicable" = "No"))

t6 <- table(printer_slice$`4.1.6 Do the authors report the name of slicing software?_bc07fc45-10aa-441f-9bdf-b32f5037389f_Answer`)


# t6_6 <- table(printer_slice$`4.1.6 Do the authors report the name of slicing software?_bc07fc45-10aa-441f-9bdf-b32f5037389f_Answer`, printer_slice$`4.1.5 Do the authors report the name of the 3D modelling software?_f88d82a9-410c-4118-ad6a-4535d12c4aca_Answer`)
# t6_6
# barplot(table(printer_slice$`4.1.6 Do the authors report the name of slicing software?_bc07fc45-10aa-441f-9bdf-b32f5037389f_Answer`), ylab = "Number of studies", cex.names=.5, col = "green")

text(x = barplot(t6, ylab = "Number of studies", ylim=c(0, max(t6) + 10), cex.names=.5 , col = "green", main = "Is the name of the slicing software reported?"), y = t6 + 2, labels = t6, cex = 0.8, )

#####
# stacked barplot to combine software & slice software

# library(ggplot2)
# 
# software <- printer_slice %>% 
#                       group_by(`4.1.5 Do the authors report the name of the 3D modelling software?_f88d82a9-410c-4118-ad6a-4535d12c4aca_Answer`, printer_slice$`4.1.6 Do the authors report the name of slicing software?_bc07fc45-10aa-441f-9bdf-b32f5037389f_Answer`) %>% count()
# 
# colnames(software) <- c("threeD-software", "slice-software", "number-studies")
# 
# #, printer_slice$`4.1.5 Do the authors report the name of the 3D modelling software?_f88d82a9-410c-4118-ad6a-4535d12c4aca_Answer`))
# 
# ggplot(software, aes(fill=`slice-software`, y=`number-studies`, x=`threeD-software`)) + 
#   geom_bar(position='stack', stat='identity')

#software$`number-studies`


############

BioInks

Give an overview of the different inks used with these techniques. - type - origin - additives - density

ABB link bioink to printing method

## Type of BioInk
t7 <- table(reconciled$`4.1.3 What type of bioink was used?_92421414-c597-4e9c-b720-9bb4318b5483_Answer`)
# clean? 

        #      Natural      Natural|Natural    Natural|Synthetic 
        #           43                    3                    5 
        # Not reported Not reported|Natural            Synthetic 
        #            2                    1                    4 
        #      Unclear 
        #            5 

# barplot(t7, ylab = "Number of studies", cex.names=.5, col = "blue")

text(x = barplot(t7, ylab = "Number of studies", ylim=c(0, max(t7) + 10), cex.names=.5 , col = "blue", main = "What type of BioInk is used"), y = t7 + 2, labels = t7, cex = 0.8, )

## If natural - what is the type type
table(reconciled$`4.1.3.1.1 If natural bioink, please choose the type._66b761ad-6630-4323-b423-c848a717aae4_Answer`)
## 
##                                                                 Other 
##                                                                     1 
##                                                  Polysaccharide based 
##                                                                    10 
##                                       Polysaccharide based;dECM based 
##                                                                     1 
##                                                         Protein based 
##                                                                    14 
##                                              Protein based;dECM based 
##                                                                     8 
##                                    Protein based;Polysaccharide based 
##                                                                    13 
##                         Protein based;Polysaccharide based;dECM based 
##                                                                     1 
##                              Protein based;Polysaccharide based;Other 
##                                                                     1 
## Protein based;Polysaccharide based|Protein based;Polysaccharide based 
##                                                                     1 
##                                              Protein based|dECM based 
##                                                                     1 
##                                           Protein based|Protein based 
##                                                                     1
# output needs cleaning 


table(reconciled$`4.1.3.1.4 If Synthetic bioink: choose the type _e74ea0e0-a654-4ae2-b59e-2e0b14a4651a_Answer`)
## 
##                      Other                   Pluronic 
##                          3                          3 
## Poly ethylene glycol (PEG) 
##                          3
## 3rd level 
table(reconciled$`4.1.3.1.2 If Protein based: choose the type._621671b3-9f7e-4a22-80ac-14b02fdd0683_Answer`)
## 
##            Collagens    Collagens;Gelatin  Collagens|Collagens 
##                    7                    3                    1 
##           Fibrinogen     Fibrinogen;Other              Gelatin 
##                    1                    1                   21 
##   Gelatin;Fibrinogen        Gelatin;Other Gelatin;Silk-fibroin 
##                    1                    2                    1 
##      Gelatin|Gelatin                Other 
##                    1                    1
table(reconciled$`4.1.3.1.3 If Polysaccharides Based: choose the type. _fcea8bcb-da6c-4154-aa44-8ff4734fa4fe_Answer`) 
## 
##                         Agarose                       Alginates 
##                               1                              19 
##                 Alginates;Other                        Chitosan 
##                               4                               1 
##                 Hyaluronic acid Hyaluronic acid|Hyaluronic acid 
##                               1                               1
## Origin of BioInk 
t8 <- table(reconciled$`4.1.3.2. What is the origin of the bioink?_34ef46b6-34ac-4ddb-a5de-07bc74272fca_Answer`)
# needs cleaning

#           commercial (ready-to-use)                   custom formulated 
#                                   6                                  44 
# custom formulated|custom formulated                        Not reported 
#                                   8                                   2 
#                             Unclear                     Unclear|Unclear 
#                                   2                                   1 

# barplot(table(reconciled$`4.1.3.2. What is the origin of the bioink?_34ef46b6-34ac-4ddb-a5de-07bc74272fca_Answer`), ylab = "Number of studies", cex.names=.5, col = "blue")

text(x = barplot(t8, ylab = "Number of studies", ylim=c(0, max(t8) + 10), cex.names=.5 , col = "blue", main = "What is the origin of BioInk"), y = t8 + 2, labels = t8, cex = 0.8, )

### Additives
# -- needs cleaning 
table(reconciled$`4.1.3.3 Which information is provided on the additives in the ink or culture? _4c2b5908-9c3c-4ba8-91f2-dd9771ac2ad4_Answer`)
## 
##                                                                   Concentration 
##                                                                               9 
##                                                      Concentration;Manufacturer 
##                                                                              25 
##                                         Concentration;Manufacturer;Order number 
##                                                                               8 
## Concentration;Manufacturer;Order number|Concentration;Manufacturer;Order number 
##                                                                               2 
##                           Concentration;Manufacturer|Concentration;Manufacturer 
##                                                                               4 
##                                        Concentration|Concentration;Manufacturer 
##                                                                               1 
##                                                                    Manufacturer 
##                                                                               1 
##                                                                            None 
##                                                                              11 
##                                                 None|Concentration;Manufacturer 
##                                                                               1 
##                                                                       None|None 
##                                                                               1
# needs cleaning


## Cell density of bioInk
table(reconciled$`4.1.3.4 Is the cell density of the bioink provided in the study? _d03a497a-c8ab-49a6-8fa7-5eca0d168c94_Answer`)
## 
##      No   No|No  No|Yes     Yes  Yes|No Yes|Yes 
##      11       1       1      43       1       6
# needs cleaning 

     # No   No|No  No|Yes     Yes  Yes|No Yes|Yes 
     # 11       1       1      43       1       6 

BioInk Sunburst plot

#### BIOINK sunburst 

# type --> 
bioink <- reconciled %>%select(
  study_ID, 
    `4.1.3 What type of bioink was used?_92421414-c597-4e9c-b720-9bb4318b5483_Answer`, 
    `4.1.3.1.1 If natural bioink, please choose the type._66b761ad-6630-4323-b423-c848a717aae4_Answer`, 
    `4.1.3.1.4 If Synthetic bioink: choose the type _e74ea0e0-a654-4ae2-b59e-2e0b14a4651a_Answer`, `4.1.3.1.2 If Protein based: choose the type._621671b3-9f7e-4a22-80ac-14b02fdd0683_Answer`, 
`4.1.3.1.3 If Polysaccharides Based: choose the type. _fcea8bcb-da6c-4154-aa44-8ff4734fa4fe_Answer`
  )  


bioink <- bioink  %>% rename(typeGeneral_level1 = `4.1.3 What type of bioink was used?_92421414-c597-4e9c-b720-9bb4318b5483_Answer`, 
   typeNatural_level2       = `4.1.3.1.1 If natural bioink, please choose the type._66b761ad-6630-4323-b423-c848a717aae4_Answer`, 
  typeSynthetic_level2 = `4.1.3.1.4 If Synthetic bioink: choose the type _e74ea0e0-a654-4ae2-b59e-2e0b14a4651a_Answer`, 
  typeProtein_level3 = `4.1.3.1.2 If Protein based: choose the type._621671b3-9f7e-4a22-80ac-14b02fdd0683_Answer`, 
  typePoly_level3 = `4.1.3.1.3 If Polysaccharides Based: choose the type. _fcea8bcb-da6c-4154-aa44-8ff4734fa4fe_Answer`
)

bioink_split1 <- separate_rows(bioink, typeGeneral_level1 , sep="\\|")
bioink_split1_1 <- separate_rows(bioink_split1, typeNatural_level2 , sep="\\|")

bioink_split1_2 <- separate_rows(bioink_split1_1, typeProtein_level3 , sep="\\|")

bioink_split1_3 <- separate_rows(bioink_split1_2, typePoly_level3 , sep="\\|")

bioink_split2 <- separate_rows(bioink_split1_3, typeNatural_level2 , sep=";")
bioink_split3 <- separate_rows(bioink_split2, typeProtein_level3 , sep=";")
bioink_split3 <- separate_rows(bioink_split3, typePoly_level3 , sep=";")
# 148 rows
# 164 rows

test_bio <- bioink_split3 %>%
     mutate(typeNatural_level2 = replace(typeNatural_level2, typeGeneral_level1!="Natural", NA), 
            typeSynthetic_level2 = replace(typeSynthetic_level2, typeGeneral_level1!="Synthetic", NA), 
            typeProtein_level3 = replace(typeProtein_level3, typeNatural_level2!="Protein based", NA), 
            typePoly_level3 =  replace(typePoly_level3, typeNatural_level2!="Polysaccharide based", NA)
            )

test_bio$typeSynthetic_level2 <- as.character(test_bio$typeSynthetic_level2)
  

### merge level 2 & merge level 3 
 test_bio$level3 <- ifelse(!is.na(test_bio$typeProtein_level3), test_bio$typeProtein_level3, test_bio$typePoly_level3)
 
  test_bio$level2 <- ifelse(!is.na(test_bio$typeNatural_level2), test_bio$typeNatural_level2, test_bio$typeSynthetic_level2)

  

#### START PLOTTING

library(dplyr)
library(plotme)


bioInk_count <-  count(test_bio, 
                       typeGeneral_level1, 
                       level2,
                       level3
                       #,study_ID
                       )


# sunburst plot
count_to_sunburst(bioInk_count)
# fill by group size
count_to_sunburst(bioInk_count, fill_by_n = TRUE)
# treemap plot, ordered by group size
count_to_treemap(bioInk_count, sort_by_n = TRUE)

Liver Cells

And then it is liver specific variables. - main type of liver cells - info about liver cells

AND - Main type of liver cells

if comments from reconciled - print out for all to see.

if any of reviewer comments say HepG2

table(reconciled$`2.2 What is the main type of liver cells included?_9bea404f-a75c-401f-af5b-8fd020306538_Answer`)
## 
##                 Hepatoma cells           Hepatoma cells;Other 
##                             36                              1 
## Induced pluripotent stem cells                          Other 
##                              5                              4 
##                  Primary cells            Primary cells;Other 
##                             16                              1
# clean? - Maren to clean 

      #                 Hepatoma cells                 Hepatoma cells;Other 
      #                             28                                    2 
      # Induced pluripotent stem cells Induced pluripotent stem cells;Other 
      #                              3                                    1 
      #                          Other                        Primary cells 
      #                             12                                   14 
      #   Primary cells;Hepatoma cells                  Primary cells;Other 
      #                              2                                    1 

### combine the ones with semi-colon - into a new category called "Combination"

liver_cells <- reconciled %>% 
  mutate(`2.2 What is the main type of liver cells included?_9bea404f-a75c-401f-af5b-8fd020306538_Answer` = recode(`2.2 What is the main type of liver cells included?_9bea404f-a75c-401f-af5b-8fd020306538_Answer`, "Hepatoma cells;Other" = "Combination")) %>% 
   mutate(`2.2 What is the main type of liver cells included?_9bea404f-a75c-401f-af5b-8fd020306538_Answer` = recode(`2.2 What is the main type of liver cells included?_9bea404f-a75c-401f-af5b-8fd020306538_Answer`, "Primary cells;Other" = "Combination")) 

t8 <- table(liver_cells$`2.2 What is the main type of liver cells included?_9bea404f-a75c-401f-af5b-8fd020306538_Answer`)

#barplot(table(reconciled$`2.2 What is the main type of liver cells included?_9bea404f-a75c-401f-af5b-8fd020306538_Answer`), ylab = "Number of studies", cex.names=.5, col = "turquoise")

text(x = barplot(t8, ylab = "Number of studies", ylim=c(0, max(t8) + 10), cex.names=.5 , col = "turquoise", main = "What type of Liver Cells are included"), y = t8 + 2, labels = t8, cex = 0.8, )

# ABB bring in the "other" from comments box 
###############################################################



# liver cells
#########################################

table(reconciled$`2.2 What is the main type of liver cells included?_9bea404f-a75c-401f-af5b-8fd020306538_Comments`)
## 
##       adult stem cell derived hepatocytes 
##                                         2 
##                                     AML12 
##                                         1 
##             bone marrow mesenchymal cells 
##                                         1 
##                   cholangiocarinoma cells 
##                                         1 
##                                     Hep3B 
##                                         2 
##                                   Hep3B\n 
##                                         1 
##                                    HepaRG 
##                                         3 
##                                HepaRG;LX2 
##                                         1 
##                  hepatic progenitor cells 
##                                         1 
##                 Hepatocellular carcinoma  
##                                         1 
##                                     HepG2 
##                                        26 
##                 hESC lines RC-6 and RC-10 
##                                         1 
##                                   hiHep\n 
##                                         1 
##                                   HMCS1SA 
##                                         1 
##                                      Huh7 
##                                         1 
##                               Huh7;HepaRG 
##                                         1 
##                         human hepatocytes 
##                                         5 
## human hepatocytes; hepatic stellate cells 
##                                         1 
##              human hepatocytes; LX2; aHSC 
##                                         1 
##            Human iPSC-derived hepatocytes 
##                                         1 
##                            liver biopsies 
##                                         1 
##      miHeps (mouse hepatocyte-like cells) 
##                                         1 
##                        murine hepatocytes 
##                                         3 
##                      murine hepatocytes\n 
##                                         1 
##                      porcine liver tissue 
##                                         1
## clean the type of liver cells comments

liverType <- tibble(
  
  study_ID = reconciled$study_ID, 
  liverCells = reconciled$`2.2 What is the main type of liver cells included?_9bea404f-a75c-401f-af5b-8fd020306538_Answer`, 
  liverCellsComment = reconciled$`2.2 What is the main type of liver cells included?_9bea404f-a75c-401f-af5b-8fd020306538_Comments`
  
)


# remove line breaks
library(stringr)
liverType$liverCellsComment <- str_replace_all(liverType$liverCellsComment, "[\n]" , "")
liverType <- separate_rows(liverType, liverCellsComment, sep=";")

# remove whitespace from start of str
liverType$liverCellsComment <- str_trim(liverType$liverCellsComment, "left")

# remove whitespace from end of str
liverType$liverCellsComment <- str_trim(liverType$liverCellsComment, "right")

liverType <- liverType %>% 
      mutate(liverCellsComment = recode(liverCellsComment, "Human iPSC-derived hepatocytes" = "human hepatocytes")) %>% 
      mutate(liverCellsComment = recode(liverCellsComment, "adult stem cell derived hepatocytes" = "human hepatocytes")) %>% 
  mutate(liverCellsComment = recode(liverCellsComment, "cholangiocarinoma cells" = "human cells - other")) %>% 
  mutate(liverCellsComment = recode(liverCellsComment, "bone marrow mesenchymal cells" = "human cells - other")) %>% 
  mutate(liverCellsComment = recode(liverCellsComment, "hepatic progenitor cells" = "human cells - other")) %>% 
  mutate(liverCellsComment = recode(liverCellsComment, "hepatic stellate cells" = "human cells - other")) %>% 
  mutate(liverCellsComment = recode(liverCellsComment, "Hepatocellular carcinoma" = "human cells - other")) %>% 
    mutate(liverCellsComment = recode(liverCellsComment, "aHSC" = "human cells - other")) %>% 
    mutate(liverCellsComment = recode(liverCellsComment, "AML12" = "human cells - other")) %>% 
    mutate(liverCellsComment = recode(liverCellsComment, "hiHep" = "human cells - other")) %>% 
   mutate(liverCellsComment = recode(liverCellsComment, "hESC lines RC-6 and RC-10" = "human cells - other")) %>% 
  mutate(liverCellsComment = recode(liverCellsComment, "HMCS1SA" = "human cells - other")) %>% 
   mutate(liverCellsComment = recode(liverCellsComment, "liver biopsies" = "human liver tissue")) %>% 
   mutate(liverCellsComment = recode(liverCellsComment, "porcine liver tissue" = "porcine liver tissue"))

# liverType$liverCellsComment

## group the mouse ones together 
# 

# create categories
liverType$liverCellsComment <- as.factor(liverType$liverCellsComment)

commentsLiver <- liverType %>%  group_by(liverCellsComment) %>% summarise(n_unique = length(unique(study_ID))) %>%  arrange(desc(n_unique))


#install.packages("formattable")
library(formattable)

formattable(commentsLiver,
            align =c("l", "r"),
            list(`Indicator Name` = formatter(
              "span", style = ~ style(color = "grey",font.weight = "bold")), 
              `n_unique`= color_bar("turquoise")
))
liverCellsComment n_unique
HepG2 26
human cells - other 10
human hepatocytes 10
HepaRG 5
murine hepatocytes 4
Hep3B 3
NA 3
Huh7 2
LX2 2
human liver tissue 1
miHeps (mouse hepatocyte-like cells) 1
porcine liver tissue 1
#### how is LIVER model Cultered? 

table(reconciled$`2.2.1 How is the presented liver model cultured?_b6e561ab-c358-47fa-b9db-61e363b73223_Answer`)
## 
##  Co-culture Monoculture     Unclear 
##          32          30           1
 # Co-culture Monoculture     Unclear 
 #         33          29           1 


barplot(table(reconciled$`2.2.1 How is the presented liver model cultured?_b6e561ab-c358-47fa-b9db-61e363b73223_Answer`), ylab = "Number of studies", cex.names=.7, col = "turquoise")

# If co-culter - what type of non-parenchymal cells 
# - need to clean
table(reconciled$`2.2.1.1 If co-cultured, what type of non-parenchymal cells are included?_b729a62f-2dc7-47b6-ada7-e1ed8e363918_Answer`)
## 
##                                     Endothelial cells 
##                                                     7 
##              Endothelial cells;Hepatic stellate cells 
##                                                     5 
##                               Endothelial cells;Other 
##                                                     6 
##                                Hepatic stellate cells 
##                                                     2 
## Immune cells;Endothelial cells;Hepatic stellate cells 
##                                                     1 
##                   Immune cells;Hepatic stellate cells 
##                                                     2 
##                                                 Other 
##                                                    10
# Maren to clean manually - bring in "other" responses from comments box



# LIVER Model

table(reconciled$`3.1 Does the study present a vascularization of the model?_3b31a6ff-4233-4f24-9e7e-2d2eb3c83420_Answer`)
## 
##                     No    Yes, with perfusion Yes, without perfusion 
##                     52                      5                      6
                    # No    Yes, with perfusion Yes, without perfusion 
                    # 52                      5                      6


barplot(table(reconciled$`3.1 Does the study present a vascularization of the model?_3b31a6ff-4233-4f24-9e7e-2d2eb3c83420_Answer`), ylab = "Number of studies", cex.names=.7, col = "turquoise")

## hypoxia 
table(reconciled$`3.2 Do the authors address hypoxia/normoxia/oxygenation of the liver model?_5b050ea7-da29-4a47-bdea-23edda5877f2_Answer`)
## 
##                  No Yes, by measurement    Yes, descriptive 
##                  59                   1                   3
                 # No Yes, by measurement    Yes, descriptive 
                 # 59                   1                   3
barplot(table(reconciled$`3.2 Do the authors address hypoxia/normoxia/oxygenation of the liver model?_5b050ea7-da29-4a47-bdea-23edda5877f2_Answer`), ylab = "Number of studies", cex.names=.7, col = "turquoise")

Liver Cell Meta-Data

# Meta-data for Liver cells

table(reconciled$`2.4 Which kind of meta data is available for the used liver cells?_2868ee50-2c4c-47e8-a040-427e4f882632_Answer`)
## 
##                      Age         Common cell line    Common cell line;None 
##                        2                       33                        4 
##            Health status                     None                  Sex;Age 
##                        1                       16                        2 
## Sex;Age;Common cell line    Sex;Age;Health status 
##                        2                        3
## common cell line; None should get merged with Common Cell line option 
# re-shape data to can number of bits of info? 

liverCell_meta <- reconciled %>% mutate(`2.4 Which kind of meta data is available for the used liver cells?_2868ee50-2c4c-47e8-a040-427e4f882632_Answer` = recode(`2.4 Which kind of meta data is available for the used liver cells?_2868ee50-2c4c-47e8-a040-427e4f882632_Answer`, "Common cell line;None" = "Common cell line"))

liverMetaData <- separate_rows(liverCell_meta, `2.4 Which kind of meta data is available for the used liver cells?_2868ee50-2c4c-47e8-a040-427e4f882632_Answer` ,sep=";")


liverMetaData_heat <- liverMetaData[,c(1, 58)]

colnames(liverMetaData_heat) <- c("study_ID", "metaData")

countsMetaDat <- liverMetaData_heat %>% group_by(study_ID) %>% summarize(n_unique = length(unique(metaData)))

table(countsMetaDat$n_unique)
## 
##  1  2  3 
## 56  2  5
#  1  2  3 
# 56  2  5 

hist(countsMetaDat$n_unique, xlab = "Number of Meta-Data Items Reported", ylab = "Number of Papers", main = "Meta-Data Items about the Cell Lines Peformed per Paper", breaks = 3)

Cells

What types of included cells? - human, animal, both

table(reconciled$`2.1 What is the origin of the cells in the liver model?_d2a55b1d-f869-4fa4-83a1-94eeb126c6fb_Answer`)
## 
## Animal   Both  Human 
##      4     14     45
#
# Animal   Both  Human 
#      4     14     45 

barplot(table(reconciled$`2.1 What is the origin of the cells in the liver model?_d2a55b1d-f869-4fa4-83a1-94eeb126c6fb_Answer`), ylab = "Number of studies", cex.names=.7, col = "pink")

If human, is it Xeno-free?

table(reconciled$`2.1.1 If human, is the described liver model xeno-free/animal-free?_7b2396a2-218d-462b-b71f-0c68bc5e9911_Answer`)
## 
##      No Unclear 
##      43       2
barplot(table(reconciled$`2.1.1 If human, is the described liver model xeno-free/animal-free?_7b2396a2-218d-462b-b71f-0c68bc5e9911_Answer`)
, ylab = "Number of studies", cex.names=.7, col = "pink")

Culture Conditions

What type of culture conditions? Liver Markers- what measurements?

table(reconciled$`5.2 How long were the liver models cultured after printing?_1f136f0a-786b-4e17-a97d-e5cf32f47b26_Answer`)
## 
##         < 72 hours 2 weeks - 3 months   3 days - 2 weeks       not reported 
##                  2                 16                 42                  3
        # < 72 hours 2 weeks - 3 months   3 days - 2 weeks       not reported 
        #          2                 16                 42                  3 
barplot(table(reconciled$`5.2 How long were the liver models cultured after printing?_1f136f0a-786b-4e17-a97d-e5cf32f47b26_Answer`), ylab = "Number of studies", cex.names=.5, col = "purple")

## ABB to order these in time order 

Liver Markers

# WHICH
t <- table(reconciled$`6.1 Which liver markers were analysed in the presented model?_1844378b-1400-4d7a-b9f5-5538df7c7b76_Answer`)
# clean? 


liverMarkers <- separate_rows(reconciled, `6.1 Which liver markers were analysed in the presented model?_1844378b-1400-4d7a-b9f5-5538df7c7b76_Answer` ,sep=";")

markers_heat <- liverMarkers[,c(1, 94)]

colnames(markers_heat) <- c("study_ID", "marker")

new_marker <- markers_heat %>% group_by(marker) %>% summarize(n_unique = length(unique(study_ID)))

new_marker$n_unique <- as.numeric(new_marker$n_unique)

sort_new_marker <- new_marker %>% arrange(desc(n_unique))



#install.packages("formattable")
library(formattable)

formattable(sort_new_marker,
            align =c("l", "r"),
            list(`Indicator Name` = formatter(
              "span", style = ~ style(color = "grey",font.weight = "bold")), 
              `n_unique`= color_bar("yellow")
))
marker n_unique
06ef33d5-b5e2-4488-b9fe-ab75c0e0a610 1
093a312d-88cc-422b-97c9-b4599d72e8d8 1
0fa47e58-c59a-4408-aac3-5d8fa2c75586 1
1265e638-0000-418e-a05e-08223f8a99ff 1
159da379-406f-4792-8160-c76769f0808a 1
19341742-a14e-401c-b18f-1877c9c3b1b9 1
1f7c632f-5591-4864-8b1f-71325c2d812f 1
22b46028-79ef-4448-aae6-bad900ce6008 1
22d8d41c-027a-4cf8-8ecc-2c6c4dd5a234 1
23513e70-fcf9-4b6b-ac65-44fed53ad8f2 1
23ef3667-cb91-4a90-9965-a529a2c21403 1
291a3569-048c-40d8-bf60-df092b633a4f 1
2c304b0e-c1ab-4c33-b72a-150b6aae6784 1
2d0bc1f5-1dab-402e-95be-391183a64171 1
2ee0fea0-5568-463c-9941-f9f92e5b408a 1
35f38190-148e-4859-a010-7982eaf2eec2 1
3b20736b-3ccc-408b-a869-bed9e12fcf6e 1
456bf91c-3191-4bbc-8c58-d3c0ff918d8c 1
49b67f4a-7bc8-43ef-b7fe-8447c1418bb7 1
508c21bb-80f6-4a15-a5cf-cbfa3c69032d 1
54d4022f-0f82-470c-bde5-edd6e17e9df9 1
57d801a4-01e6-4926-94db-3e0a266e8c28 1
60af380e-434c-4cda-8622-401cddd00dde 1
60f61788-ddbd-470c-8c10-e9d7a0c28b49 1
6357589b-6ef3-4f4e-85e3-08480a5fb795 1
691dc367-254a-48a7-9a40-3a349f7476c8 1
6f47955c-4164-444e-95f4-ea02866b5397 1
734144b9-42d1-47eb-83ed-afb7c7ad5827 1
7401d1cc-59ff-4859-afae-a28065132375 1
7ac74bf0-81b2-4662-af82-ac26e9d008b3 1
7c5736c9-a2cc-40d5-a4c4-722760c6b1d1 1
7f8919f1-36f3-4cd1-915a-b22a2c036b4f 1
82c9eae7-3802-47f0-bd88-f6827a1e81c4 1
84922b7a-69ec-4801-a5e1-3e757eafaad3 1
8879436f-be33-4bde-95b9-e7016101123f 1
8913f706-6a47-4fca-9ab4-5e69e93d12a1 1
89eeef77-49f2-44ef-ae3a-695e1ba36241 1
8aa93971-914e-4786-93dd-3c014d392b30 1
8aef8a73-c767-4ad6-a478-eebb1daa3201 1
8bc9b574-8465-4e0a-a07f-b609eab8d30a 1
93cf9c26-e608-43c4-b1df-178bdf00a23f 1
96ded665-2a27-40a4-864d-0bd60bd7cfba 1
a6e69fee-62a4-4654-8f31-f2537b05e8a6 1
a8b5617f-0a81-437a-ae05-1889f53b7a1f 1
a9f18f8f-23f1-44e1-9cab-cf51cbcdc90d 1
af0abb61-3b07-4b8d-b651-67881c7df72b 1
bd34b0d1-8a3d-4225-add7-add7caaf93c8 1
bfac329b-9c92-49fa-a82e-e83f0101c9c3 1
c14af8b6-e7d9-4baa-ac2c-949487d2f8d1 1
c4fdee85-6300-413d-97f3-662b2efd632c 1
c6ac7eef-ce3e-4a08-adf3-8e20bb025141 1
c84b9308-8737-4f6c-b40b-c9598403fc86 1
cb3f5665-dd13-41e7-8ba2-6bd2ddc5ba26 1
cba0dcca-7ee9-4921-844e-16ac01541e08 1
cef68bc4-6006-42f8-a56d-177f17d9473f 1
d0017bf5-654d-40a7-803d-28b4390cd736 1
d64637f4-db91-4a52-a05a-61b2e8a48e94 1
d852f5db-f656-4a6c-9ebb-c02ec9a2537d 1
e069f69c-0c6e-4129-aeaa-8cc8508e90cc 1
e3daf1ba-1293-41e9-9b68-360c2419b428 1
f00f39d9-0d92-4fcf-ae53-1378d2e00524 1
f6de0c24-8fe2-43d9-be75-e15536009e76 1
fad5fa41-6871-461f-8b26-bfcd79692031 1
######################
# liver marker "Other"

t <- table(reconciled$`6.1 Which liver markers were analysed in the presented model?_1844378b-1400-4d7a-b9f5-5538df7c7b76_Comments`)

## clean the type of liver cells comments


liverMarkerComments_rows <- separate_rows(reconciled, `6.1 Which liver markers were analysed in the presented model?_1844378b-1400-4d7a-b9f5-5538df7c7b76_Comments`
   ,sep=";")

liverMarkerComments <- tibble(
  study_ID = liverMarkerComments_rows$study_ID, 
  liverMarker = liverMarkerComments_rows$`6.1 Which liver markers were analysed in the presented model?_1844378b-1400-4d7a-b9f5-5538df7c7b76_Answer`, 
  liverMarkerComment = liverMarkerComments_rows$`6.1 Which liver markers were analysed in the presented model?_1844378b-1400-4d7a-b9f5-5538df7c7b76_Comments`
  
)

# remove line breaks
library(stringr)
liverMarkerComments$liverMarkerComment <- str_replace_all(liverMarkerComments$liverMarkerComment, "[\n]" , "")

liverMarkerComments_rows <- separate_rows(liverMarkerComments,liverMarkerComment
   ,sep=",")

liverMarkerComments_rows <- separate_rows(liverMarkerComments_rows,liverMarkerComment
   ,sep=" and")

# # would replace all white space
# liverMarkerComments$liverMarkerComment <- str_replace_all(liverMarkerComments$liverMarkerComment, "[^\d]+" , "")

# remove line breaks
liverMarkerComments_rows$liverMarkerComment <- str_replace_all(liverMarkerComments_rows$liverMarkerComment, "[\n]" , "")

# remove whitespace from start of str
liverMarkerComments_rows$liverMarkerComment <- str_trim(liverMarkerComments_rows$liverMarkerComment, "left")

# remove whitespace from end of str
liverMarkerComments_rows$liverMarkerComment <- str_trim(liverMarkerComments_rows$liverMarkerComment, "right")

liverMarkerComments_clean <- liverMarkerComments_rows %>%  
          mutate(liverMarkerComment = recode(liverMarkerComment,
                                       "albumin" = "Albumin", 
                                       "ALB" = "Albumin", 
                                       " ALB" = "Albumin",
                                       "    ALB" = "Albumin",
                                       "albumin ELISA" = "Albumin", 
                                       "Albumin " = "Albumin",
                                        "albumin (ALB)" = "Albumin", 
                                       "qPCR: albumin" = "Albumin",
                                       " Albumin" =  "Albumin",
                                       "human albumin" =  "Albumin",
                                       
                                       "urea" = "Urea", 
                                       "urea " = "Urea",
                                       " urea" = "Urea",
                                       " Urea" = "Urea",
                                       
                                       " transthyre- tin (TTR)" = "TTR", 
                                        " transthyretin (TTR)" = "TTR", 
                                       " transthyretin TTR" = "TTR", 
                                       " TTR" = "TTR", 
                                       "transthyretin TTR" = "TTR",
                                       "transthyretin (TTR)" = "TTR",
                                       "transthyre- tin (TTR)"  = "TTR",
                                       "transferrin" = "TTR",
                                       
                                      "HNF4a" = "HNF4alpha", 
                                     " HNF4a" = "HNF4alpha", 
                                     " HFN4alpha" = "HNF4alpha", 
                                     "  HNF4alpha" = "HNF4alpha", 
                                     "HFN4A" = "HNF4alpha",
                                     "s HNF4a" = "HNF4alpha",
                                     " HNF4alpha" = "HNF4alpha", 
                                     "  HFN4alpha" = "HNF4alpha", 
                                 "hepatocyte nuclear factor 4α (HNF4A)" = "HNF4alpha",
                                   "HFN4alpha"  = "HNF4alpha", 
                                     
                                     
                                     " AFP" = "AFP",
                                     " alpha-fetoprotein (AFP)" = "AFP", 
                                     " alpha-fetoprotein" = "AFP", 
                                     "alpha-fetoprotein levels (HCC marker)" = "AFP", 
                                     " α-fetoprotein (AFP)" = "AFP", 
                                     "alpha-fetoprotein" = "AFP", 
                                     "Alpha-fetoprotein AFP" = "AFP", 
                                     "alpha-fetoprotein (AFP)" = "AFP",
                                     "α-fetoprotein (AFP)" = "AFP",
                                     
                                     
                                     " cytokeratin 19 (CK19)" = "cytokeratin 19 (CK19)", 
                                     " cytokeratin 19" = "cytokeratin 19 (CK19)",
                                     " CK-19" = "cytokeratin 19 (CK19)",
                                     "CK-19" = "cytokeratin 19 (CK19)",
                                     "cytokeratin 19"  = "cytokeratin 19 (CK19)",
                                     
                                     
                                 "CK18" = "cytokeratin 18 (CK18)", 
                                 
                              
                                     "staning for MRP2" = "MRP2", 
                                     " MRP2" = "MRP2",
                        "multidrug resist- ance-associated protein 2 (MRP2)" = "MRP2",
                                     
                                     
                                     "CYP4A4 activity" = "CYP3A4", 
                                      " CYP3A4" = "CYP3A4",              
                                     " CYP3A4" = "CYP3A4", 
                                     "Cyp3A4"= "CYP3A4", 
                                 "cytochrome P450 3A4 (CYP3A4)" = "CYP3A4",
                                 
                                 "Cytochromes 1A2" = "CYP1A2", 
                                 
                                
                                 "alpha-1 antitrypsin (A1AT)" = "alpha-1 antitrypsin", 
                                 "alpha-1 antitrypsin (AAT)" = "alpha-1 antitrypsin", 
                                 "Alpha 1 antitrypsin" = "alpha-1 antitrypsin"
                                                     )) 

commentsLiver <- liverMarkerComments_clean %>%  group_by(liverMarkerComment) %>% summarise(n_unique = length(unique(study_ID))) %>%  arrange(desc(n_unique))

commentsLiver
#install.packages("formattable")
library(formattable)

formattable(commentsLiver,
            align =c("l", "r"),
            list(`Indicator Name` = formatter(
              "span", style = ~ style(color = "grey",font.weight = "bold")), 
              `n_unique`= color_bar("yellow")
))
liverMarkerComment n_unique
Albumin 36
NA 23
Urea 16
AFP 12
HNF4alpha 9
CYP3A4 7
TTR 5
CYP1A2 4
MRP2 4
alpha-1 antitrypsin 4
3
cytokeratin 18 (CK18) 3
cytokeratin 19 (CK19) 3
ASGR1 2
CD31 2
CYP 2
CYP2B6 2
CYP2C19 2
CYP2C9 2
2C19 1
3-dioxygenase 1
3A4 1
ABCC2 1
ACTA2 1
ALDOB 1
ASGPR1 1
ATP 1
COLA1 1
CYP1A1 1
CYP2E1 1
Collagen A1 1
E-cadherin 1
Foxa3 1
GST 1
Glutathione S-transferase alpha 1 1
MDR1 1
MMP2 1
NMDA receptor 1 iso- form NR1-2 variant 1
NR1/2(PXR) 1
NR1H4(FXR) 1
OCT 1
SERPINA1 1
TIMP1 1
Zo-1 1
alpha-smooth muscle actin (α-SMA) 1
asialoglycoprotein receptor 1 1
beta-Catenin 1
bile salt export pump (BSEP) 1
ceruloplasmin 1
glucose_x0002_6-phosphatase catalytic subunit (ABCG2) 1
glutamate dehydrogenase 1
glutathione s-transferase alpha (alpha-GST) 1
hepatic markers ATP-binding cassette super-family G member 2 (G6PC) 1
hepatocyte nuclear factor 1α (HNF1A) 1
hepatocyte nuclear factor 3β (HNF3B) 1
hepatocyte nuclear factor 6 (HNF6) 1
organic anion transporter protein 1B3 (OATP1B3) 1
secretion 1
total bile acids 1
total protein 1
tryptophan 2 1
tyrosine amino-transferase 1
## trying 6.4 
# which metabolites were analysed 
t <- table(reconciled$`6.4 Which metabolites were analyzed in the study?_5652d702-1441-4234-b37d-f0b44d64c5e9_Answer`)

liverMetabolite <- separate_rows(reconciled, `6.4 Which metabolites were analyzed in the study?_5652d702-1441-4234-b37d-f0b44d64c5e9_Answer`
   ,sep=";")

liverMetabolite$`6.4 Which metabolites were analyzed in the study?_5652d702-1441-4234-b37d-f0b44d64c5e9_Comments` <- str_replace_all(liverMetabolite$`6.4 Which metabolites were analyzed in the study?_5652d702-1441-4234-b37d-f0b44d64c5e9_Comments`, "[\n]" , "")

liverMetabolite_comments <-  liverMetabolite %>% select(c(study_ID, `6.4 Which metabolites were analyzed in the study?_5652d702-1441-4234-b37d-f0b44d64c5e9_Answer`, `6.4 Which metabolites were analyzed in the study?_5652d702-1441-4234-b37d-f0b44d64c5e9_Comments`))


commentsLiverMetabolite <- liverMetabolite_comments %>%  group_by(`6.4 Which metabolites were analyzed in the study?_5652d702-1441-4234-b37d-f0b44d64c5e9_Answer`) %>% summarise(n_unique = length(unique(study_ID))) %>%  arrange(desc(n_unique))


otherLiverMetabolite <- liverMetabolite_comments %>%  group_by(`6.4 Which metabolites were analyzed in the study?_5652d702-1441-4234-b37d-f0b44d64c5e9_Comments`) %>% summarise(n_unique = length(unique(study_ID))) %>%  arrange(desc(n_unique))

# print(otherLiverMetabolite)

#install.packages("formattable")
library(formattable)

formattable(commentsLiverMetabolite,
            align =c("l", "r"),
            list(`Indicator Name` = formatter(
              "span", style = ~ style(color = "grey",font.weight = "bold")), 
              `n_unique`= color_bar("yellow")
))
6.4 Which metabolites were analyzed in the study?_5652d702-1441-4234-b37d-f0b44d64c5e9_Answer n_unique
Albumin 47
Urea 24
None 15
Other 7
Bile acid 3
#### CLEAN THIS!! 
formattable(otherLiverMetabolite, 
             align = c("l", "r"), 
             list(`Indicator Name` = formatter(
              "span", style = ~ style(color = "grey",font.weight = "bold")), 
              `n_unique`= color_bar("yellow")
            
            ))
6.4 Which metabolites were analyzed in the study?_5652d702-1441-4234-b37d-f0b44d64c5e9_Comments n_unique
NA 56
ASS, involved in Urea cycle 1
Alpha-fetoprotein AFP; transthyretin TTR 1
Glucose 1
albumin, alpha-fetoprotein, MKI67, Casp8 1
alpha-fetoprotein, alpha-1-antitrypsin 1
aspartate, formate, glycine, histidine and tryptophan 1
transferrin, ceruloplasmin, alpha-1 antitrypsin 1
#####################


# WHERE
table(reconciled$`6.1.1 Where were the liver markers measured?_a70225ae-f529-4b91-bcc9-8081d7efc6e2_Answer`)
## 
##        Cells        Media  Media;Cells Not reported 
##           10           15           19           19
       # Cells        Media  Media;Cells Not reported 
       #    10           15           19           19 
barplot(table(reconciled$`6.1.1 Where were the liver markers measured?_a70225ae-f529-4b91-bcc9-8081d7efc6e2_Answer`), ylab = "Number of studies", cex.names=.7, col = "yellow")

# CYP450 
table(reconciled$`6.2 Does the study analyse the Cytochrome P450 CYP450 level in the print?_3c21cc1f-1431-49c7-ad8f-bda83956828a_Answer`)
## 
##  No Yes 
##  33  30
 # No Yes 
 # 33  30 

barplot(table(reconciled$`6.2 Does the study analyse the Cytochrome P450 CYP450 level in the print?_3c21cc1f-1431-49c7-ad8f-bda83956828a_Answer`), ylab = "Number of studies", cex.names=.7, col = "yellow")

table(reconciled$`6.2.1 If yes, which cytochrome isoforms were analysed?_62bdffd7-d9c7-4646-9f66-9510f5bf2649_Answer`)
## 
##                         CYP1A                  CYP1A;CYP1A2 
##                             3                             1 
##                   CYP1A;CYP2E                   CYP1A;CYP3A 
##                             1                             4 
##             CYP1A;CYP3A;CYP2B       CYP1A;CYP3A;CYP2B;CYP2C 
##                             1                             1 
## CYP1A;CYP3A;CYP2B;CYP2C;CYP2D CYP1A;CYP3A;CYP2B;CYP2C;CYP2E 
##                             1                             1 
##  CYP1A;CYP3A;CYP2B;YP2C;CYP2D       CYP1A;CYP3A;CYP2C;CYP2D 
##                             1                             1 
##                         CYP2C                         CYP2E 
##                             1                             1 
##                         CYP3A                   CYP3A;CYP2D 
##                             9                             1 
##             CYP3A;CYP2D;CYP2E                  Not reported 
##                             1                             2
## output needs cleaning

liverCytochome <- separate_rows(reconciled, `6.2.1 If yes, which cytochrome isoforms were analysed?_62bdffd7-d9c7-4646-9f66-9510f5bf2649_Answer`
   ,sep=";")

liverCytochome_only <-  liverCytochome %>% select(c(study_ID, `6.2.1 If yes, which cytochrome isoforms were analysed?_62bdffd7-d9c7-4646-9f66-9510f5bf2649_Answer`, `6.2.1 If yes, which cytochrome isoforms were analysed?_62bdffd7-d9c7-4646-9f66-9510f5bf2649_Comments`))


liverCytochome_only <- liverCytochome_only %>%  group_by(`6.2.1 If yes, which cytochrome isoforms were analysed?_62bdffd7-d9c7-4646-9f66-9510f5bf2649_Answer`) %>% summarise(n_unique = length(unique(study_ID))) %>%  arrange(desc(n_unique))

formattable(liverCytochome_only,
            align =c("l", "r"),
            list(`Indicator Name` = formatter(
              "span", style = ~ style(color = "grey",font.weight = "bold")), 
              `n_unique`= color_bar("yellow")
))
6.2.1 If yes, which cytochrome isoforms were analysed?_62bdffd7-d9c7-4646-9f66-9510f5bf2649_Answer n_unique
NA 33
CYP3A 21
CYP1A 15
CYP2B 5
CYP2C 5
CYP2D 5
CYP2E 4
Not reported 2
CYP1A2 1
YP2C 1
## agonists
table(reconciled$`6.3 Have agonists of the receptors for the inducibility of CYPs been applied?_ac9f38a8-8fe2-44de-a180-24fddd78fb59_Answer`)
## 
##  No Yes 
##  55   8
 # No Yes 
 # 54   9 
barplot(table(reconciled$`6.3 Have agonists of the receptors for the inducibility of CYPs been applied?_ac9f38a8-8fe2-44de-a180-24fddd78fb59_Answer`), ylab = "Number of studies", cex.names=.7, col = "yellow")

Quality

Does the study describe quality assurance?

table(reconciled$`5.3 Does the study describe quality-assuring assays for the printed model?_09745b80-9723-4e5c-8a47-dfc8a9c71a6d_Answer`)
## 
## Yes 
##  63
# Yes 
#  63

Which assays were performed?

library(tidyverse)
### messy - needs cleaning
messy_assay <- table(reconciled$`5.3.1 Which assays were performed to assure the quality of the liver model?_8a415412-28c6-48ff-840a-538ea69a068f_Answer`)
# needs cleaning 


assays <- separate_rows(reconciled, `5.3.1 Which assays were performed to assure the quality of the liver model?_8a415412-28c6-48ff-840a-538ea69a068f_Answer` ,sep=";")

assays_heat <- assays[,c(1, 91)]

colnames(assays_heat) <- c("study_ID", "assay")

new <- assays_heat %>% group_by(assay) %>% summarize(n_unique = length(unique(study_ID)))

new$n_unique <- as.numeric(new$n_unique)

sort_new <- new %>% arrange(desc(n_unique))


#install.packages("formattable")
library(formattable)

formattable(sort_new,
            align =c("l", "r"),
            list(`Indicator Name` = formatter(
              "span", style = ~ style(color = "grey",font.weight = "bold")), 
              `n_unique`= color_bar("lightgreen")
))
assay n_unique
00cc0c37-b022-404a-b30e-d3fb8aae4eb2 1
023ca941-3fce-4c49-8775-12b6ffd16893 1
071c4d52-f350-4ad4-83f7-ea1e5ce2f4da 1
080e5c5a-8808-4c2a-88dc-aeb5c0bf936c 1
08d2b95b-de1b-4a0a-b35b-a0750f9173cd 1
09029872-0c13-4234-958f-003758870e4a 1
0a516490-66e5-46e7-8b0d-d6633c5e711f 1
0fe1c7dd-cbba-4269-9c99-f4fbae0be8a2 1
10af8297-1353-4d84-b174-cdbf8e91f09d 1
1708bd0c-bbf4-460b-a1d8-ac0bcf034747 1
20725176-9637-4eb5-9c26-268c8a9c7dd4 1
22d806c3-dd9f-4c0a-9f90-90a30de88143 1
23994736-df6e-4e3d-9bf6-cf72886473bc 1
278ca74b-af55-4a9a-8109-28bc6daa16b8 1
27db00e3-1178-479f-b1ef-a6413bc44544 1
28f9b386-7074-4cbd-97cc-e61c24f8f418 1
2995b7a0-2470-48a6-bf6c-f0d340e72c35 1
2b4864eb-922f-4144-b57a-da58b5be3837 1
357dffe5-15fc-4b6e-834d-689d0df05f49 1
36373b30-b997-4d10-a7b0-614b35f5931d 1
3905142b-ae1a-457a-87e2-eee65a7220e5 1
3b3aa440-092e-448d-9445-adb5ef1a632e 1
3be15011-921d-428c-9dfb-16d8abd5c551 1
40120d28-f32c-44aa-9a0a-854ebe59831c 1
42d83e6c-22da-4594-a9cd-433937f0f463 1
46f620d3-fccb-41a2-910b-a4a85546d6e1 1
473c388f-ba72-4b33-9371-efbc90268911 1
508fa86e-2248-4205-8250-285e0d9c5966 1
55799bab-9b0a-4005-a890-58f20cb065aa 1
63f9ba31-13d3-46d6-87e9-51166eabeaf5 1
6a2da839-e5ce-4f42-bf65-72f9bb748462 1
731db6a7-9cfd-490f-989a-15bffea7a36a 1
78c2d6f8-9141-45aa-9744-e5e1f8544c52 1
7bbcad4e-6f5a-408c-bd86-aa7658baa33f 1
7c3eec45-6d93-4b2c-bb61-9be9107a5e38 1
7cbf4b0b-59dd-4e68-a7bf-28c7c7c41f0f 1
803f0bb1-dc54-4d9a-84d5-73e255d24990 1
81be1c7b-18df-4bd4-b4df-3093f0a7e793 1
868ec33f-85c2-4129-a4c4-9ace595336d0 1
8777f4d4-f095-4bad-a4ee-7c32dfd0eae2 1
90fb9b24-7f8e-47b9-a100-2f9812329d4a 1
991638e8-dac7-402d-b406-c8a09b0bb7de 1
993e4e97-78b0-49f3-8648-4bd46e8cf4a9 1
9c4fdebe-6b99-4053-85a9-f6cef5c76676 1
9d79df0c-bf7c-4a29-aa09-1ad0897f4df6 1
9ed1d4cf-eae9-4790-8395-fba74c0f5f89 1
b22d5793-bc9f-4cfb-b243-137ab23d21f1 1
b2c5c748-8537-40f1-bb0a-bf5e5da87ef4 1
b39d2dd2-9cac-44d7-9e05-9488a441131a 1
bea587d7-73e6-4ef3-b21a-9b847cdee87c 1
c7bef60d-a5d3-4cba-a6fa-d5267dd65d9e 1
c942ead2-9e10-455f-a210-8779bc3a9fd0 1
c9d09bf3-980c-44eb-959b-767c60854b46 1
cf37774b-2eda-4b55-a805-b0c6472d16aa 1
d2d4c81a-e355-44fa-8b68-9ebb3eef6e7e 1
d6b90343-0018-4635-b812-1c3f34b23791 1
d7424460-0980-461c-8956-9d5c75639188 1
d8f51651-3e50-46e6-bcba-1e03b8d20876 1
ead21089-74c1-4ba3-ac93-6362ed3b1f2f 1
eb06ad61-f33b-4017-be14-6ef22d7363fa 1
f460aa28-3a25-4cc0-8706-ba797e835387 1
f72292c9-2377-40ea-acd6-2e78ca48d045 1
fb7fca9b-c897-461c-b807-a72d61137272 1
### 10 different tests are used across 63 papers, a total of 252 tests were used. 
# the most popular are listed below








## also how many assay were performed? 1, 2, 3, 4, 5, or more. 


counts <- assays_heat %>% group_by(study_ID) %>% summarize(n_unique = length(unique(assay)))

table(counts$n_unique)
## 
##  1 
## 63
 # 1  2  3  4  5  6  7 
 # 4 10  6 17 16  8  2

hist(counts$n_unique, xlab = "Number of Assays Reported", ylab = "Number of Papers", main = "Number of Assays Peformed per Paper",)

Applications in the paper

# Application 
table(reconciled$`7.1 Do the authors apply the model in the study?_a6895d38-a9ed-4605-a092-4f06ebbd9e2b_Answer`)
## 
##  No Yes 
##  35  28
 # No Yes 
 # 35  28 

barplot(table(reconciled$`7.1 Do the authors apply the model in the study?_a6895d38-a9ed-4605-a092-4f06ebbd9e2b_Answer`), ylab = "Number of studies", cex.names=.7, col = "gray")

# field of application 
table(reconciled$`7.1.1 please select the field of application. _d332c2ee-9864-434f-8595-90305808e32d_Answer`)
## 
##                                                          Disease modeling 
##                                                                         3 
##                                                       Drug dosage testing 
##                                                                         2 
##                                      Drug dosage testing;Disease modeling 
##                                                                         1 
## Drug dosage testing;Xenograft (implantation into animal);Disease modeling 
##                                                                         1 
##                                                 Implant / Medical surgery 
##                                                                         1 
##                                                                     Other 
##                                                                         3 
##                                                          Toxicity testing 
##                                                                        10 
##                                      Toxicity testing;Drug dosage testing 
##                                                                         4 
##                                Toxicity testing;Drug dosage testing;Other 
##                                                                         1 
##                                      Xenograft (implantation into animal) 
##                                                                         2
# import numpy as np
# import pandas as pd
# 
# import plotly.graph_objects as go
# import plotly.express as px
# import plotly.colors
# from plotly.subplots import make_subplots
# 
# from rpy2.robjects.packages import importr
# import rpy2.robjects

library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:formattable':
## 
##     style
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
screening_info <- c('Records obtained from the Medline database',
                  'Records obtained from previous reviews',
                  "",
                    "Exclusion critera:<br>
                    - work relying only on MRI;<br>
                    - work relying only on histology or equivalent approach;<br>
                    - work reporting only qualitative comparisons.",
                  "",
                  'Records selected for full-text evaluation',
                  "",
                    "Exclusion criteria:<br>
                    - studies using MRI-based measures in arbitrary units;<br>
                    - studies using measures of variation in myelin content;<br>
                    - studies using arbitrary assessment scales;<br>
                    - studies comparing absolute measures of myelin with relative measures;<br>
                    - studies reporting other quantitative measures than correlation or R^2 values;<br>
                    - studies comparing histology from one dataset and MRI from a different one.",
                  "",
                  'Studies selected for literature overview',
                  "",
                    "Exclusion criteria:<br>
                     - not providing an indication of both number of subjects and number of ROIs.",
                  "")


fig1 <- plot_ly(
  type = "sankey", 
  orientation = "h", 
 # arrangement = "freeform", 
  node = list(
    label = c("Main records identified (database searching)",
             "Additional records (reviews)",
             "Records screened",
             "Records excluded",
             "Full-text articles assessed for eligibility",
             "Full-text articles excluded",
             "Studied included in the literature overview",
             "Studies included in the meta-analysis"), 
    Color = c("darkblue","darkblue","darkblue","darkred","darkgreen","darkred","darkgreen","darkgreen"), 
    pad = 15, 
    thickness = 20, 
    line = list(
     color =  "black", 
     width = 0.5
    ), 
   domain = 
     list(x = c(0, 0, 0.4, 0.6, 0.5, 0.8, 0.7, 1),
    y = c(0, 0, 0.5, 0.8, 0.15, 0.05, 0.4, 0.6)),
    
    link = list(
    source = c(0, 1, 2, 2, 4, 4, 6),
    target = c(2, 2, 3, 4, 5, 6, 7),
    value = c(688, 1, 597, 92, 34, 58, 43)
  #  ,customdata = screening_info,
  #  hovertemplate = "%{customdata}"
  ), 
  
  width=950,
height=500 
 #    x=1.02, y=-0.21,
 # sizex=0.05, sizey=0.05,
# xanchor="right", yanchor="bottom"
)
) 



fig1 <- fig1 %>% layout(
    title = "Screening Sankey Diagram",
    
    font = list(
      size = 12
    )
)

fig1
###########################################################



fig <- plot_ly(
    type = "sankey",
    orientation = "h",
    node = list(
       label = c("Main records identified (database searching)",
             "Additional records (reviews)",
             "Records screened",
             "Records excluded",
             "Full-text articles assessed for eligibility",
             "Full-text articles excluded",
             "Studied included in the literature overview",
             "Studies included in the meta-analysis"), 
      Color = c("darkblue","darkblue","darkblue","darkred","darkgreen","darkred","darkgreen","darkgreen"), 
      pad = 15,
      thickness = 20,
      line = list(
        color = "black",
        width = 0.5
      )
    ),

     link = list(
    source = c(0, 1, 2, 2, 4, 4, 6),
    target = c(2, 2, 3, 4, 5, 6, 7),
    value = c(688, 1, 597, 92, 34, 58, 43)
    )
  )


fig <- fig %>% layout(
    title = "Basic Sankey Diagram",
    font = list(
      size = 10
    )
)

fig
# fig1 = go.Figure(data=[go.Sankey(
#   arrangement = "freeform",
#   node = dict(
#     pad = 15,
#     thickness = 20,
#     line = dict(color = "black", width = 0.5),
#     # label = ["Main records identified (database searching)",
#     #          "Additional records (reviews)",
#     #          "Records screened",
#     #          "Records excluded",
#     #          "Full-text articles assessed for eligibility",
#     #          "Full-text articles excluded",
#     #          "Studied included in the literature overview",
#     #          "Studies included in the meta-analysis"],
#     x = [0, 0, 0.4, 0.6, 0.5, 0.8, 0.7, 1],
#     y = [0, 0, 0.5, 0.8, 0.15, 0.05, 0.4, 0.6],
#     hovertemplate = "%{label}<extra>%{value}</extra>",
#    # color = ["darkblue","darkblue","darkblue","darkred","darkgreen","darkred","darkgreen","darkgreen"]
#   ),
#   link = dict(
#     source = [0, 1, 2, 2, 4, 4, 6],
#     target = [2, 2, 3, 4, 5, 6, 7],
#     value = [688, 1, 597, 92, 34, 58, 43],
#     customdata = screening_info,
#     hovertemplate = "%{customdata}",
#   ))])
# 
# fig1.update_layout(images=[dict(
#   source="neurolibre.svg",
#   xref="paper", yref="paper",
#   x=1.02, y=-0.21,
#   sizex=0.05, sizey=0.05,
#   xanchor="right", yanchor="bottom"
# )],
# width=950,
# height=500,
# font_size=12)
# 
# fig1.add_annotation(x=1.003, y=-0.205, xref="paper", yref="paper",
#                     text="<a href=\"https://neurolibre.com\" target=\"_blank\" " +
#                       "style=\"color:gray!important\">NeuroLibre</a>", showarrow=False)
# 
# fig1.show()